package com.dhl.fin.api.service;

import com.dhl.fin.api.common.service.CommonService;
import com.dhl.fin.api.domain.LendDailyInterest;
import com.dhl.fin.api.domain.LendRecord;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author CuiJianbo
 * @since 2025/4/25
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class LendDailyInterestService extends CommonService<LendDailyInterest> {


    public void addLendDailyInterest(Double interestAmount, Double penaltyAmount, Integer lendBalanceAmount, LendRecord lendRecord) throws Exception {

        LendDailyInterest lendDailyInterest = new LendDailyInterest();
        lendDailyInterest.setLendBalanceAmount(lendBalanceAmount);
        lendDailyInterest.setInterestAmount(interestAmount);
        lendDailyInterest.setPenaltyAmount(penaltyAmount);
        lendDailyInterest.setLendRecord(lendRecord);

        saveOrUpdate(lendDailyInterest);
    }

}
